<?php
class Persona extends ActiveRecord{
    public function ver($page=1){
        return $this->paginate("page: $page",'per_page: 2');
        
        /* Filtra todo los registro que sean igual a estatus 1
         * return $this->paginate("page: $page",'per_page: 2','estatus = 1');
         */
    }
    public function getPersona($dato = null, $campo='id', $orden='desc', $page, $ppage=10){
             if(!empty ($dato)) 
               $where1 = " and $campo LIKE '%$dato%'";  
               //$conditions = "conditions: $campo LIKE '%$dato%'";
               //$conditions = "conditions: $campo LIKE '%$dato%'";
                else 
               $conditions = null;
               $where = 'WHERE estatus = 1'.$where1 ; 
               $sql = "
                    SELECT
                             id 
                             ,nombre
                             ,apellido
                             ,cedula
                             ,email
                      FROM
                              persona 
                    $where
                        
                  ORDER BY
                    $campo $orden
                ";
          //echo $sql; die();
          return $this->paginate_by_sql($sql, "page: $page", "per_page: $ppage");
          
     }
        
 }
    